package com.eshore.server;

import android.content.*;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
public class DBHelper extends SQLiteOpenHelper {
	
	public static SQLiteDatabase sqldb=null;
	public static final int DATABASE_VERSION = 1;
	public static final String DB_NAME = "mbschool.db";
	public static final String TABLE_NAME = "ms_courses_plan";

	// Column Names
	public static final String KEY_ID = "_id";
	public static final String KEY_PLANID = "planid";
	public static final String KEY_DATE = "date";
	public static final String KEY_COURSES = "courses";
	public static final String KEY_CLASS_URL = "class_url";
	public static final String KEY_CLASS_PATH = "class_path";
	public static final String KEY_STATUS = "status";
	public static final String KEY_REMARKS = "remarks";
	public static final String Create_TBL = "create table IF NOT EXISTS "
		+ TABLE_NAME
		+ " ("
		+ KEY_ID
		+ " integer primary key autoincrement, "
		+ KEY_PLANID
		+ " TEXT, "
		+ KEY_DATE
		+ " DATETIME, "
		+ KEY_COURSES
		+ " TEXT, "
		+ KEY_CLASS_URL
		+ " TEXT, "
		+ KEY_CLASS_PATH
		+ " TEXT, "
		+ KEY_STATUS
		+ " INTEGER, "
		+ KEY_REMARKS
		+ " TEXT);";
	
	public DBHelper(Context context) {
		super(context, DB_NAME, null, DATABASE_VERSION);
		sqldb = getWritableDatabase();
	}


	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

	}


	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(DBHelper.Create_TBL);
		Log.d("sqllite","Create Table ok!");
	}

}

